package com.filesearcher;
import java.awt.Component;

import javax.swing.BorderFactory;
import javax.swing.JComponent;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextPane;
import javax.swing.SwingUtilities;
import javax.swing.border.BevelBorder;
import javax.swing.border.TitledBorder;

import org.jdesktop.layout.GroupLayout;
import org.jdesktop.layout.LayoutStyle;

/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class AboutDialog extends javax.swing.JDialog {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private JPanel aboutContentsPanel;
	private JLabel versionLabel;
	private JTextPane otherInfoText;
	private JLabel releaseDateLabel;
	private JLabel releaseDateTextLabel;
	private JLabel createdNameLabel;
	private JLabel createdLabel;
	private JLabel versionNumberLabel;

	/**
	* Auto-generated main method to display this JDialog
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				JFrame frame = new JFrame();
				AboutDialog inst = new AboutDialog(frame);
				inst.setVisible(true);
			}
		});
	}
	
	public AboutDialog(JFrame frame) {
		super(frame);
		initGUI();
		
		versionNumberLabel.setText( GrepSearchUI.VERSION_NUMBER );
		releaseDateTextLabel.setText( GrepSearchUI.RELEASE_DATE );
	}
	
	private void initGUI() {
		try {
			GroupLayout thisLayout = new GroupLayout((JComponent)getContentPane());
			getContentPane().setLayout(thisLayout);
			this.setResizable(false);
			{
				aboutContentsPanel = new JPanel();
				GroupLayout aboutContentsPanelLayout = new GroupLayout((JComponent)aboutContentsPanel);
				aboutContentsPanel.setLayout(aboutContentsPanelLayout);
				aboutContentsPanel.setBorder(BorderFactory.createTitledBorder(null, "About", TitledBorder.LEADING, TitledBorder.TOP));
				{
					versionNumberLabel = new JLabel();
				}
				{
					versionLabel = new JLabel();
					versionLabel.setText("Version : ");
				}
				{
					createdLabel = new JLabel();
					createdLabel.setText("Created By :");
				}
				{
					createdNameLabel = new JLabel();
					createdNameLabel.setText("James Steadman");
				}
				{
					releaseDateLabel = new JLabel();
					releaseDateLabel.setText("Release Date :");
				}
				{
					otherInfoText = new JTextPane();
					
					String otherInfoString = "This program uses swing-layout-1.0.3.jar found at https://swing-layout.dev.java.net/ \n\n" +
							"The search algoritham is based upon the Grep.java file found here " +
							"http://java.sun.com/j2se/1.4.2/docs/guide/nio/example/Grep.java";
					
					otherInfoText.setText(otherInfoString);
					otherInfoText.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
					otherInfoText.setEditable(false);
				}
				{
					releaseDateTextLabel = new JLabel();					
				}
				aboutContentsPanelLayout.setHorizontalGroup(aboutContentsPanelLayout.createSequentialGroup()
					.addContainerGap()
					.add(aboutContentsPanelLayout.createParallelGroup()
					    .add(aboutContentsPanelLayout.createSequentialGroup()
					        .add(aboutContentsPanelLayout.createParallelGroup()
					            .add(aboutContentsPanelLayout.createSequentialGroup()
					                .add(0, 0, Short.MAX_VALUE)
					                .add(createdLabel, GroupLayout.PREFERRED_SIZE, 143, GroupLayout.PREFERRED_SIZE))
					            .add(GroupLayout.LEADING, versionLabel, GroupLayout.PREFERRED_SIZE, 143, GroupLayout.PREFERRED_SIZE)
					            .add(GroupLayout.LEADING, releaseDateLabel, GroupLayout.PREFERRED_SIZE, 143, GroupLayout.PREFERRED_SIZE))
					        .addPreferredGap(LayoutStyle.RELATED, 6, GroupLayout.PREFERRED_SIZE)
					        .add(aboutContentsPanelLayout.createParallelGroup()
					            .add(GroupLayout.LEADING, versionNumberLabel, GroupLayout.PREFERRED_SIZE, 143, GroupLayout.PREFERRED_SIZE)
					            .add(GroupLayout.LEADING, createdNameLabel, GroupLayout.PREFERRED_SIZE, 143, GroupLayout.PREFERRED_SIZE)
					            .add(GroupLayout.LEADING, releaseDateTextLabel, GroupLayout.PREFERRED_SIZE, 143, GroupLayout.PREFERRED_SIZE))
					        .add(44))
					    .add(GroupLayout.LEADING, otherInfoText, 0, 336, Short.MAX_VALUE))
					.addContainerGap());
				aboutContentsPanelLayout.linkSize(new Component[] {versionLabel, releaseDateLabel, createdLabel, createdNameLabel, releaseDateTextLabel, versionNumberLabel}, GroupLayout.HORIZONTAL);
				aboutContentsPanelLayout.setVerticalGroup(aboutContentsPanelLayout.createSequentialGroup()
					.addContainerGap()
					.add(aboutContentsPanelLayout.createParallelGroup(GroupLayout.BASELINE)
					    .add(GroupLayout.BASELINE, versionNumberLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					    .add(GroupLayout.BASELINE, versionLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(LayoutStyle.RELATED)
					.add(aboutContentsPanelLayout.createParallelGroup(GroupLayout.BASELINE)
					    .add(GroupLayout.BASELINE, releaseDateTextLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					    .add(GroupLayout.BASELINE, releaseDateLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(LayoutStyle.RELATED)
					.add(aboutContentsPanelLayout.createParallelGroup(GroupLayout.BASELINE)
					    .add(GroupLayout.BASELINE, createdNameLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					    .add(GroupLayout.BASELINE, createdLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(LayoutStyle.UNRELATED)
					.add(otherInfoText, 0, 88, Short.MAX_VALUE)
					.addContainerGap());
			}
			thisLayout.setVerticalGroup(thisLayout.createSequentialGroup()
				.addContainerGap()
				.add(aboutContentsPanel, 0, 200, Short.MAX_VALUE)
				.addContainerGap());
			thisLayout.setHorizontalGroup(thisLayout.createSequentialGroup()
				.addContainerGap()
				.add(aboutContentsPanel, 0, 370, Short.MAX_VALUE)
				.addContainerGap());
			this.setSize(400, 249);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
